
\documentclass{article}

\usepackage{multirow}

\begin{document}

%grid o' numbers
\begin{tabular}{ l c r }
	1 & 2 & 3 \\
	4 & 5 & 6 \\
	7 & 8 & 9 \\
\end{tabular}

%now with vertical lines
\begin{tabular}{ | l || c || r | }
	1 & 2 & 3 \\
	4 & 5 & 6 \\
	7 & 8 & 9 \\
\end{tabular}

%horizontal lines on top and bot
\begin{tabular}{ | l | c | r | }
\hline
	1 & 2 & 3 \\
	4 & 5 & 6 \\
	7 & 8 & 9 \\
\hline
\end{tabular}

%now an actual grid (and centered this time)
\begin{center}
	\begin{tabular}{ || l | c | r || }
	\hline
	\hline
		1 & 2 & 3 \\ \hline
		4 & 5 & 6 \\ \hline
		7 & 8 & 9 \\
	\hline
	\hline
	
	\end{tabular}
\end{center}

%Without specifying width for last column:
\begin{center}
	\begin{tabular}{ | l | l | l | l |}
	\hline
		Day & Min Temp & Max Temp & Summary \\ \hline
		Monday & 11C & 22C & A clear day with lots of sunshine.  However, the strong breeze will bring down the temperatures. \\ \hline
		Tuesday & 9C & 19C & Cloudy with rain, across many northern regions. Clear spells across most of Scotland and Northern Ireland, but rain reaching the far northwest. \\ \hline
		Wednesday & 10C & 21C & Rain will still linger for the morning. Conditions will improve by early afternoon and continue throughout the evening. \\
	\hline
	\end{tabular}
\end{center}

%With width specified:
\begin{center}
	\begin{tabular}{ | l | l | l | p{5cm} |}
	\hline
		Day & Min Temp & Max Temp & Summary \\ \hline
		Monday & 11C & 22C & A clear day with lots of sunshine.  However, the strong breeze will bring down the temperatures. \\ \hline
		Tuesday & 9C & 19C & Cloudy with rain, across many northern regions. Clear spells across most of Scotland and Northern Ireland, but rain reaching the far northwest. \\ \hline
		Wednesday & 10C & 21C & Rain will still linger for the morning. Conditions will improve by early afternoon and continue throughout the evening. \\
	\hline
	\end{tabular}
\end{center}

% specifies total table width, but not column width. hlines extend way past the last column.
\begin{tabular*}{0.75\textwidth}{ | c | c | c | r | }
\hline
	label 1 & label 2 & label 3 & label 4 \\
\hline
	item 1 & item 2 & item 3 & item 4 \\
\hline
\end{tabular*}

% this time tell the columns to widen themselves to fit the overall table width
\begin{tabular*}{0.75\textwidth}{@{\extracolsep{\fill}} | c | c | c | r | }
\hline
	label 1	&	label 2	&	label 3	&	label 4	\\
\hline
	item 1	& 	item 2	&	item 3	&	item 4	\\
\hline
\end{tabular*}

% @{} inserts its argument into each cell in a column before the actual data. Also supresses inter-column space, but space can be added with @{\hspace{width}}.

%using @ to align numbers on the decimal:
\begin{tabular}{r@{.}l}
	3&14159\\
	16&2\\
	123&456\\
\end{tabular}

%using @ to squish columns horizontally in several ways:
\begin{tabular}{|l|l|}			%normal spacing
\hline
stuff & stuff \\ \hline
stuff & stuff \\
\hline
\end{tabular}

\begin{tabular}{|@{}l|l@{}|}		%text squished up against outer lines
\hline
stuff & stuff \\ \hline
stuff & stuff \\
\hline
\end{tabular}

\begin{tabular}{|l@{}|@{}l|}		%text squished into inner line
\hline
stuff & stuff \\ \hline
stuff & stuff \\
\hline
\end{tabular}

\begin{tabular}{|@{}l@{}|@{}l@{}|}	%that text can barely fit!
\hline
stuff & stuff \\ \hline
stuff & stuff \\
\hline
\end{tabular}

% overriding the overall table format to make the top row span multiple columns
\begin{tabular}{|l|l|}
	\hline
	\multicolumn{2}{|c|}{Team sheet} \\
	\hline
	GK & Paul Robinson	\\
	LB & Lucus Radebe	\\
	DC & Michael Duberry	\\
	DC & Dominic Matteo	\\
	RB & Didier Domi	\\
	MC & David Batty	\\
	MC & Jody Morris	\\
	FW & Jamie McMaster	\\
	ST & Alan Smith		\\
	ST & Mark Viduka	\\
	\hline
\end{tabular}

%Making columns span multiple rows (requires \usepackage{multirow})
\begin{tabular}{|l|l|l|}
	\hline
	\multicolumn{3}{|c|}{Team sheet}		\\
	\hline
	Goalkeeper & GK & Paul Robinson			\\ \hline
	\multirow{4}{*}{Defenders} & LB & Lucus Radebe	\\
	& DC & Michael Duberry				\\
	& DC & Dominic Mateo				\\
	& RB & Didier Domi				\\ \hline
	\multirow{3}{*}{Midfielders} & MC & David Batty	\\
	& MC & Eirik Bakke				\\
	& MC & Jody Morris				\\ \hline
	\multirow{2}{*}{Strikers} & ST & Alan Smith	\\
	& ST & Mark Viduka				\\
	\hline
\end{tabular}





\end{document}

